<%@ page import="com.hotel.entity.HistoricalSubscription" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/hotel/style/style.css"></link>
    <style type="text/css">
        body {
            margin: 0;
            padding: 0;
            font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(to right, #e0f7fa, #80deea);
        }

        #container {
            max-width: 900px;
            margin: 0 auto;
            padding: 20px;
        }

        #content {
            padding: 20px 0;
            display: flex;
            justify-content: center;
        }

        table {
            width: 100%;
            max-width: 800px;
            border-collapse: collapse;
            background-color: #ffffff;
            box-shadow: 0 4px 8px rgba(0,0,0,0.1);
            border-radius: 8px;
            overflow: hidden;
            font-size: 0.95em;
        }

        caption {
            padding: 20px 0;
            font-size: 1.5em;
            font-weight: bold;
            text-align: center;
            color: #006064;
        }

        th, td {
            border: 1px solid #b0bec5;
            padding: 12px 15px;
            text-align: center;
            vertical-align: middle;
        }

        th {
            background-color: #00838f;
            color: white;
            font-weight: bold;
        }

        td {
            color: #333;
        }

        .type {
            width: 150px;
        }

        .price {
            width: 120px;
        }

        .introduce {
            text-align: left;
            padding-left: 15px;
        }

        #content div.button {
            text-align: center;
            padding-top: 15px;
        }

        hr {
            margin-top: 40px;
            border: none;
            border-top: 1px solid #ccc;
        }

        #footer {
            text-align: center;
            padding: 20px;
            font-size: 0.9em;
            color: #666;
        }



    </style>
    <title>历史订单</title>
</head>
<body>
<%
    List<HistoricalSubscription> historicalSubscriptions = (List<HistoricalSubscription>) request.getAttribute("historicalOrders");
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
%>
<div id="container">
    <div id="header">
        <ul>
            <li><a href="#">帮助</a></li>
        </ul>
    </div>
    <div id="menu">
        <ul>
            <li><a href="<%=request.getContextPath()%>/hotel/index.jsp">首页</a></li>
            <li><a href="<%=request.getContextPath()%>/list.book">图书列表</a></li>
            <li><a href="<%=request.getContextPath()%>/list.subscription">会员中心</a></li>
        </ul>
    </div>
    <div id="content">
        <div class="submenu">
            <ul>
                <li><a href="<%=request.getContextPath()%>/list.subscription">图书预订</a></li>
                <li><a href="<%=request.getContextPath()%>/list.hsubscription">历史订单</a></li>
                <li><a href="<%=request.getContextPath()%>/editMember.member">修改信息</a></li>
                <li><a href="<%=request.getContextPath()%>/hotel/editPassword.jsp">修改密码</a></li>
                <li><a href="<%=request.getContextPath()%>/hotel/index.jsp">退出系统</a></li>
            </ul>
        </div>
        <div class="subcontent">
            <p>下面是尚未确认的预定信息，您可以增加、修改或删除订单信息。</p>
            <table>
                <thead>
                <tr>
                    <th>创建时间</th>
                    <th>订单号</th>
                    <th>联系人</th>
                    <th>联系电话</th>
                    <th>电子邮件</th>
                    <th>状态</th>
                </tr>
                </thead>
                <tbody>
                <%
                    if (historicalSubscriptions != null && !historicalSubscriptions.isEmpty()) {
                        for (HistoricalSubscription h : historicalSubscriptions) {
                %>
                <tr>
                    <td><%= h.getCretime() != null ? sdf.format(h.getCretime()) : "无" %></td>
                    <td><%= h.getNo() %></td>
                    <td><%= h.getLinkman() %></td>
                    <td><%= h.getPhone() %></td>
                    <td><%= h.getEmail() %></td>
                    <td><%= h.getStatus() %></td>
                </tr>
                <%
                    }
                } else {
                %>
                <tr>
                    <td colspan="6" style="color:#999;">暂无历史订单数据</td>
                </tr>
                <%
                    }
                %>
                </tbody>
            </table>
        </div>
    </div>
    <hr />
    <div id="footer"></div>
</div>
</body>
</html>
